<?php 


$upload = current($_FILES);
var_dump($upload);

if(empty($upload)){
	echo "上传失败.错误代码:".$upload['error'];exit;
}

$typearr = array('jpg','png','txt','php','xls','html');
$uploadHZ = explode('.', $upload['name']);
$uploadHZ = end($uploadHZ);


if (!in_array($uploadHZ,$typearr)) {
	echo "不支持上传该类型的文件";exit;
}

is_dir('./Images') || mkdir('./Images');

$newname = uniqid();

if(move_uploaded_file($upload['tmp_name'], './Images/'.$newname.'.'.$uploadHZ)){
	echo "上传成功".$newname.'.'.$uploadHZ;
}else{
	echo "上传失败.错误代码:".$upload['error'];
}

header('Location:./index.php');





 ?>